#__Author:Administrator
#__Date:2019/6/25
import os
#import sys
#
#sys.path.append(BASE_DIR)
from lib import commons

class Nid:
    """
    生成nid
    """
    def __init__(self, role, db_path):
        """
        :param role: 角色
        :param db_path:
        """
        role_list= [
            'admin', 'school', 'teacher', 'course', 'course_to_teacher', 'classes', 'student', 'students_to_classes'
        ]

        if role not in role_list:
            raise Exception("用户角色定义错误，请使用以下角色%s" % ','.join(role_list))
        self.role = role
        self.db_path = db_path
        self.uuid = commons.create_uuid()

class AdminNid(Nid):
    """
    生成管理员NID
    """
    def __init__(self, db_path):
        super(AdminNid, self).__init__("admin", db_path)

class ClassesNid(Nid):
    """
    生成班级NID
    """
    def __init__(self, db_path):
        super(ClassesNid, self).__init__("classes", db_path)


class CourseNid(Nid):
    def __init__(self, db_path):
        super(CourseNid, self).__init__("course", db_path)

class TeacherNid(Nid):
    def __init__(self, db_path):
        super(TeacherNid, self).__init__("teacher", db_path)

class StudentNid(Nid):
    def __init__(self, db_path):
        super(StudentNid, self).__init__("student", db_path)

class SchoolNid(Nid):
    def __init__(self, db_path):
        super(SchoolNid, self).__init__("student", db_path)

class Course_to_TeacherNid(Nid):
    def __init__(self, db_path):
        super(Course_to_TeacherNid, self).__init__("course_to_teacher", db_path)

class Students_to_ClasssesNid(Nid):
    def __init__(self, db_path):
        super(Students_to_ClasssesNid, self).__init__("studentes_to_classes", db_path)
